/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.plt.bc;

import edu.upn.sigemfi.plt.be.Microseguro;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Gerard
 */
@Stateless
public class MicroseguroFacade implements MicroseguroFacadeLocal {
    @PersistenceContext(unitName="edu.upn.sigemfi.plt-ejbPU")
    private EntityManager em;

    public void create(Microseguro microseguro) {
        em.persist(microseguro);
    }

    public void edit(Microseguro microseguro) {
        em.merge(microseguro);
    }

    public void remove(Microseguro microseguro) {
        em.remove(em.merge(microseguro));
    }

    public Microseguro find(Object id) {
        return em.find(Microseguro.class, id);
    }

    public List<Microseguro> findAll() {
        return em.createQuery("select object(o) from Microseguro as o").getResultList();
    }

}
